<?php

defined('SYSPATH') or die('No direct access allowed.');

class Controller_Ajax extends Controller {
    
    public function action_loadmedia(){
        $media = ORM::factory('books')->find_all()->as_array();
        $out = array();
        
        foreach($media as $key => $m){
            $out[$key] = $m->as_array();
        }
        
        $out = json_encode($out);
        
        echo $out;
        
        //$view = View::factory('ajax/loadmedia');
        
        //$view = $view->render();
        
        //$this->request->response = $view;
    }

}

